from fastapi import HTTPException

# 异常基类
class BaseAPIException(HTTPException):
    def __init__(self, status_code: int = 400, detail: str = "请求发生错误", error_type: str = "APIError"):
        self.error_type = error_type
        super().__init__(status_code=status_code, detail=detail)

# PPT状态更新失败
class PPTStateUpdateError(BaseAPIException):
    def __init__(self, ppt_id: int, state: int):
        super().__init__(
            status_code=500,
            detail=f"PPT ID {ppt_id} 状态更新失败，当前状态为 {state}",
            error_type="PPTStateUpdateError"
        )

# PPT查找失败
class PPTNotExistError(BaseAPIException):
    def __init__(self, ppt_id: int):
        super().__init__(
            status_code=500,
            detail=f"PPT ID{ppt_id} 的PPT不存在",
            error_type="PPTNotExistError"
        )

class SlideNotExistError(BaseAPIException):
    def __init__(self, slide_id: int):
        super().__init__(
            status_code=500,
            detail=f"Slide ID{slide_id} 的Slide不存在",
            error_type="SlideNotExistError"
        )